# -*- coding: utf-8 -*-
from re import match, sub
import re
import os


def valid_login( txt ):    
    ''' Checks for valid login '''        
    if match( '^[A-Za-z0-9_-]+?$', txt ):         
        RestrictedSybmols =[ 
                            'www',
                            'email',
                            'mail',
                            'admin',
                            'sys',
                            'system',
                            'dev', 
                            'pic',
                            'usr',
                            'k1',
                            'k2',
                            'k3',
                            'k4'                            
                             ]       
        if txt not in RestrictedSybmols: return True    
    return False
        
def valid_email( text ):
    if match(r"""^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$""", text, re.IGNORECASE):  # domain
        return True
    else:
        return False